package com.sskj.fca.ui.activity;


import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.flyco.tablayout.SlidingTabLayout;
import com.sskj.common.adapter.MyFragmentPagerAdapter;
import com.sskj.common.base.App;
import com.sskj.lib.Constans;
import com.sskj.lib.RConfig;
import com.sskj.lib.base.BaseActivity;
import com.sskj.fca.R;
import com.sskj.fca.presenter.BankerJackpotActivityPresenter;

import java.util.ArrayList;

import butterknife.BindView;

@Route(path = RConfig.APP_BANKER_JACKPOT)//庄家奖池
public class BankerJackpotActivity extends BaseActivity<BankerJackpotActivityPresenter> {
    @BindView(R.id.slidingTabLayout)
    SlidingTabLayout slidingTabLayout;
    @BindView(R.id.viewPager)
    ViewPager viewPager;
    @Autowired
    String moneyType;


    @Override
    protected int getLayoutResId() {
        return R.layout.app_activity_banker_jackpot;
    }

    @Override
    public BankerJackpotActivityPresenter getPresenter() {
        return new BankerJackpotActivityPresenter();
    }

    @Override
    protected void initView() {
        setTitle(App.INSTANCE.getString(R.string.app_activity_banker_jackpot));
        ARouter.getInstance().inject(this);

        ArrayList<Fragment> fragments = new ArrayList<>();
        ArrayList<String> titles = new ArrayList<>();
        titles.add("主页");
        titles.add("坐庄");
        titles.add("历史");
        fragments.add((Fragment) ARouter.getInstance().build(RConfig.APP_FRAGMENT_BANKER_JACKPOT_MAIN).withString(Constans.MONEY_TYPE, moneyType).navigation());
        fragments.add((Fragment) ARouter.getInstance().build(RConfig.APP_FRAGMENT_BANKER_JACKPOT_HOLD).withString(Constans.MONEY_TYPE, moneyType).navigation());
        fragments.add((Fragment) ARouter.getInstance().build(RConfig.APP_FRAGMENT_BANKER_JACKPOT_HISTORY).withString(Constans.MONEY_TYPE, moneyType).navigation());
        viewPager.setOffscreenPageLimit(3);
        viewPager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager(), titles, fragments));
        slidingTabLayout.setViewPager(viewPager);

    }
}
